package com.dd.common.dto.system.menu;

import com.dd.common.pojo.dto.group.CreateGroup;
import com.dd.common.pojo.dto.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * @author cheng
 */
@Schema(description = "系统菜单DTO")
@Data
public class SysMenuDTO implements java.io.Serializable {

    @Null(message = "ID必须为空", groups = CreateGroup.class)
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    @Schema(description = "菜单ID", example = "1")
    @Min(value = 1, message = "ID必须是正整数")
    private Long id;

    @Schema(description = "父菜单ID", example = "1")
    @Min(value = 1, message = "ID必须是正整数")
    private Long parentId;

    @NotBlank(message = "名称不能为空", groups = CreateGroup.class)
    @Schema(description = "名称", example = "系统管理")
    private String menuName;

    @NotBlank(message = "类型不能为空", groups = CreateGroup.class)
    @Schema(description = "类型：1-目录，2-菜单，3-按钮", example = "2")
    private String menuType;

    @NotBlank(message = "路径不能为空", groups = CreateGroup.class)
    @Schema(description = "路由路径（前端用）", example = "/system")
    private String path;

    @Schema(description = "组件路径", example = "system/User")
    private String component;
    @Schema(description = "按钮权限标识", example = "system:user:add")
    private String perms;
    @Schema(description = "图标", example = "el-icon-user")
    private String icon;
    @Schema(description = "排序", example = "1")
    @Range(min = 0, message = "排序值只能是正整数")
    private Integer sort;
    @Schema(description = "可见性：1-可见，0-不可见", example = "1")
    @Range(min = 0, max = 1, message = "可见性值只能是0或1")
    private Integer visible;
    @Schema(description = "状态：1-正常，0-禁用", example = "1")
    @Range(min = 0, max = 1, message = "状态值只能是0或1")
    private Integer status;
    @Schema(description = "选中时高亮的路径", example = "/system/user")
    private String selected;
    @Schema(description = "固定的路由参数，JSON格式", example = "{\"id\":1}")
    private String params;
    @Schema(description = "是否缓存：1-缓存，0-不缓存", example = "1")
    @Range(min = 0, max = 1, message = "缓存值只能是0或1")
    private Integer isCache;

}
